import request from '@/utils/request.ts'
import { userResponseData } from '@/api/acl/user/type.ts'
// 获取用户信息
export const getUserData = (page: number, limit: number, username: string) =>
  request.get<any, userResponseData>(
    `/admin/acl/user/${page}/${limit}?username=${username}`,
  )
// 添加和更新
export const addOrUpdateUser = (data: any) => {
  if (data.id) {
    return request.put<any, any>('/admin/acl/user/update', data)
  } else {
    return request.post<any, any>('/admin/acl/user/save', data)
  }
}
//删除
export const remove = (id: number) =>
  request.delete<any, any>(`/admin/acl/user/remove/${id}`)
// 多项删除
export const someRemove = (idList: any) =>
  request.delete<any, any>(`/admin/acl/user/batchRemove`, { data: idList })
//获取职位
export const getRole = (adminId: number) =>
  request.get<any, any>(`/admin/acl/user/toAssign/${adminId}`)
//分配角色接口
export const setRole = (data: any) =>
  request.post(`/admin/acl/user/doAssignRole`, data)
